Fix: Windows submenu icons support#308
Merged
amrbashir merged 7 commits intotauri-apps:devfrom Jul 28, 2025
Merged
Conversation
Contributor
Author
|
@amrbashir please review these changes, as submenu icons won't work on Windows without these fixes |
4 tasks
amrbashir
requested changes
Jul 27, 2025
Member
amrbashir
left a comment
There was a problem hiding this comment.
Thank you, could you also add a change file in .changes directory?
Contributor
Author
|
@amrbashir Hi, sorry — I missed internal_id() earlier. After updating it, everything started working. I've fixed it and also added the change_file. |
amrbashir
reviewed
Jul 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is a follow-up to PR #277 which added submenu icon support across all platforms. While the initial implementation worked on macOS and Linux, I discovered that submenu icons were not displaying correctly on Windows due to incorrect ID handling.
Problem
On Windows, submenu icons were not displaying correctly. The issue was that the Windows API requires different handling for submenu icons compared to regular menu items.
Root Cause
In
src/platform_impl/windows/mod.rs, the code was using the same ID (internal_id) for both regular menu items and submenus when setting icons:However, Windows API requires different IDs for submenus (
hmenu) vs regular menu items (internal_id).Solution
Modified the icon setting logic to use the correct ID based on the menu item type:
internal_idas beforehmenuas the IDUpdated both the initial icon setting in
add_menu_itemand the dynamic icon setting inset_iconmethod.Changes Made
src/platform_impl/windows/mod.rs:add_menu_itemandset_iconmethodsExamples:
examples/test_submenu_icons.rsTesting